package epsi.mobile.helpers;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.widget.Toast;
 
// Helper for manage database
public class DBCreateHelper extends SQLiteOpenHelper 
{
	public DBCreateHelper(Context context, String name, CursorFactory factory, int version) {
		super(context, name, factory, version);
	}
 
	// Function to create table
	public void createTable(SQLiteDatabase db, String TableRequest) 
	{
		try
		{
			db.execSQL(TableRequest);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
	
	// Function for update table (delete + insert)
	public void updateTable(SQLiteDatabase db, String tableName, String TableRequest) {

		db.execSQL("DROP TABLE " + tableName + ";");
		createTable(db,TableRequest);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
	}
 
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	}
}